package com.itheima.charstream;

import java.io.File;
import java.io.FileWriter;
import java.io.IOException;

/*
字符流写数据
 */
public class Demo01 {

    public static void main(String[] args) throws IOException {
       // FileWriter writer = new FileWriter("day13\\a.txt");
        FileWriter writer = new FileWriter("day13\\a.txt",true);
       // FileWriter writer = new FileWriter(new File("day13\\a.txt"));
       // FileWriter writer = new FileWriter(new File("day13\\a.txt"),true);

        //一个字
        writer.write('魑');
        writer.flush();
        //多个字
        char[] chars = {'魑', '魅', '魍', '魉'};
        writer.write(chars);
        writer.flush();
        //多个字中的一部分
        writer.write(chars,2,2);
        //一个字符串
        writer.write("吴签签");
        writer.flush();
        //一个字符串中的一部分
        writer.write("妖魔鬼怪吴签签",0,4);
        writer.flush();

        writer.close();

    }
}
